package com.ztz.musicappdemo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.ztz.musicappdemo.R;
import com.ztz.musicappdemo.bean.UserInfo;

import java.util.List;

/**
 * Created by wqewqe on 2017/4/12.
 */

public class UserInfoAdapter extends BaseAdapter {
    Context context;
    List<UserInfo> userInfoList;

    public UserInfoAdapter(Context context, List<UserInfo> userInfoList) {
        this.context = context;
        this.userInfoList = userInfoList;
    }

    @Override
    public int getCount() {
        return userInfoList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return userInfoList.get(position).getId();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view= LayoutInflater.from(context).inflate(R.layout.item_userinfo,parent,false);
        TextView userName=(TextView)view.findViewById(R.id.user_Name);
        TextView userPassword=(TextView)view.findViewById(R.id.user_password);
        TextView userPhone=(TextView)view.findViewById(R.id.user_phone);
        TextView userSex=(TextView)view.findViewById(R.id.user_sex);
        userName.setText(userInfoList.get(position).getUserName());
        userPassword.setText(userInfoList.get(position).getPassword());
        userPhone.setText(userInfoList.get(position).getPhone());
        userSex.setText(userInfoList.get(position).getSex());
        return view;
    }
}
